package com.ewhale.feitengguest.presenter.shop.deal

import com.ewhale.feitengguest.api.ApiHelper
import com.ewhale.feitengguest.dto.ShopTaskDto
import com.ewhale.feitengguest.dto.WaitHandleDto
import com.ewhale.feitengguest.view.shop.deal.SDealView
import com.ewhale.feitengguest.view.shop.task.STaskView
import com.simga.library.base.IPresenter
import com.simga.library.http.APIException

/**
 * 作者：SimGa
 * 日期：2020/1/2
 * 时间：11:15
 * 包名：com.ewhale.feitengguest.presenter.shop.deal
 */
class SDealPresenter : IPresenter(){
    fun loadTaskList(pageNumber: Int) {
        request(1, ApiHelper.TASK_API.getShopWaitHandle(pageNumber,10),null)
    }

    override fun <T : Any?> onNext(postCode: Int, result: T, data: Any?) {
        super.onNext(postCode, result, data)
        when(postCode){
            1->(mView as SDealView).showDealList(result as List<WaitHandleDto>)
        }
    }

    override fun otherException(postCode: Int, data: Any?, e: APIException?) {
        super.otherException(postCode, data, e)
        mView.showErrorMessage(postCode,e!!.code,e.displayMessage)
    }
}
